package com.nw.redis;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisShardInfo;

/**
 * @Auther: Administrator
 * @Date: 2018/8/10 0010 09:19
 * @Description:
 */
@Service
public class RedisService {
    /*@Autowired
    JedisPool jedisPool;*/

    @Autowired
    RedisConfig redisConfig;

    public Jedis getInstance(){
        JedisShardInfo jedisShardInfo = new JedisShardInfo(redisConfig.getHost(),redisConfig.getHost());
        jedisShardInfo.setPassword(redisConfig.getPassword());
        Jedis jedis = new Jedis(jedisShardInfo);
        return jedis;
    }
}